import { EnumSchema } from '@/utils/common/types';
import { PresetColorEnum } from '@/enums/colorEnum';
// import { useI18n } from '@/hooks/web/useI18n';

/** 移动端平台枚举 */
export enum MobilePlatformEnum {
  /** 苹果IOS系统 */
  IOS = 'IOS',
  /** 安卓系统 */
  Android = 'ANDROID',
  /** 华为鸿蒙系统 */
  Harmony = 'HARMONY',
  /** 小米澎湃系统 */
  Hyper = 'HYPER',
  /** 苹果Mac系统 */
  Mac = 'MAC',
  /** Windows系统 */
  Windows = 'WINDOWS',
  /** Linux系统 */
  Linux = 'LINUX',
}

/** 移动端平台实体 */
export class MobilePlatformEntity {
  /** 枚举值 */
  Value: MobilePlatformEnum;
  /** 显示描述 */
  Display: string;
  /** 颜色 */
  Color?: PresetColorEnum | string;

  constructor(value: MobilePlatformEnum, color?: PresetColorEnum | string) {
    // const { t } = useI18n();
    this.Value = value;
    this.Color = color;
    switch (value) {
      case MobilePlatformEnum.IOS:
        this.Display = 'IOS';
        this.Color = this.Color ? this.Color : PresetColorEnum.Default;
        break;
      case MobilePlatformEnum.Android:
        this.Display = 'Android';
        this.Color = this.Color ? this.Color : PresetColorEnum.Green;
        break;
      case MobilePlatformEnum.Harmony:
        this.Display = 'Harmony';
        this.Color = this.Color ? this.Color : PresetColorEnum.Blue;
        break;
      case MobilePlatformEnum.Hyper:
        this.Display = 'Hyper';
        this.Color = this.Color ? this.Color : PresetColorEnum.Orange;
        break;
      case MobilePlatformEnum.Mac:
        this.Display = 'Mac';
        this.Color = this.Color ? this.Color : PresetColorEnum.Default;
        break;
      case MobilePlatformEnum.Windows:
        this.Display = 'Windows';
        this.Color = this.Color ? this.Color : PresetColorEnum.Geekblue;
        break;
      case MobilePlatformEnum.Linux:
        this.Display = 'Linux';
        this.Color = this.Color ? this.Color : PresetColorEnum.Purple;
        break;
    }
  }
}

//#region 获取移动端平台枚举架构
/**
 * 获取移动端平台枚举架构
 */
export function getMobilePlatformEnumSchema(enableTag = true): EnumSchema[] {
  const enumSchema: EnumSchema[] = [];
  const entities: MobilePlatformEntity[] = [
    new MobilePlatformEntity(MobilePlatformEnum.IOS),
    new MobilePlatformEntity(MobilePlatformEnum.Android),
    new MobilePlatformEntity(MobilePlatformEnum.Harmony),
    new MobilePlatformEntity(MobilePlatformEnum.Hyper),
    new MobilePlatformEntity(MobilePlatformEnum.Mac),
    new MobilePlatformEntity(MobilePlatformEnum.Windows),
    new MobilePlatformEntity(MobilePlatformEnum.Linux),
  ];
  entities.forEach((item) => {
    enumSchema.push({
      key: item.Value,
      label: item.Display,
      value: item.Value,
      tag: enableTag,
      tagColor: item.Color,
    });
  });
  return enumSchema;
}
//#endregion
